package com.xhx.spring.service.postprocess;

import cn.hutool.core.util.StrUtil;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

public class MyBeanPostProcessor implements BeanPostProcessor {

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        if (StrUtil.equals("beanLifeService", beanName)) {
            System.out.println("MyBeanPostProcessor before,beanName=" + beanName + "...4");
        }
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if (StrUtil.equals("beanLifeService", beanName)) {
            System.out.println("MyBeanPostProcessor after,beanName=" + beanName + "...6");
        }
        return bean;
    }

}
